//调用会员列表接口
import {memberList} from "../../../request/api";
const state = {
  memberlist: [],
};
const getters = {
  getMemberList(state) {
      return state.memberlist;
  },
};

const mutations = {
  REQ_MEMBERLIST(state, payload) {
      state.memberlist = payload
  }
};

const actions = {
  // 封装一个行动，来调用接口
  changeMemberAction({
      commit
  }) {
      memberList().then((res) => {
          // console.log(res, "角色列表");
          if (res.code == 200) {
              let list = res.list ? res.list : [];
              commit('REQ_MEMBERLIST', list)
          }
      });
  },
};

export default {
  state,
  getters,
  mutations,
  actions,
  namespaced: true,
};